package com.songlanyun.modules.marketing.groupbuy.service;

import com.songlanyun.common.drive.IBaseService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyTeam;
import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyTeamMember;
import com.songlanyun.modules.marketing.groupbuy.model.vo.GroupBuyOrderVO;
import com.songlanyun.modules.marketing.groupbuy.model.vo.GroupBuyTeamMemberSlimVO;
import com.songlanyun.modules.marketing.groupbuy.model.vo.TeamMemberUserInfoVO;
import com.songlanyun.modules.order.entity.Order;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 拼团活动的成员
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-27 14:03:39
 */
public interface GroupBuyTeamMemberService extends IBaseService<Long,GroupBuyTeamMember> {


     /**
      * 获取所有团长支付过期的成员
      * @return
      */
     List<GroupBuyTeamMember> loadLeaderPayExpire() ;

     /**
      * 获取所有员支付过期的成员
      * @return
      */
     List<GroupBuyTeamMember> loadMemberPayExpire() ;


     /**
      * 获取团下面的所有成员
      * @param teamId
      * @return
      */
     List<GroupBuyTeamMember> loadAllMember(Long teamId) ;


     /**
      * 获取团下面所有参与成功的成员
      * @param teamId
      * @return
      */
     List<GroupBuyTeamMember> loadJoinSuccessMember(Long teamId) ;

     /**
      * 获取团下面所有支付成功的成员
      * @param teamId
      * @return
      */
     List<GroupBuyTeamMember> loadValidMember(Long teamId);

     /**
      * 获取团下面所有有效的成员人数
      * @param teamId
      * @return
      */
     Integer  loadJoinSuccessCount(Long teamId);

     /**
      * 获取团下面所有支付成功的成员人数
      * @param teamId
      * @return
      */
     Integer loadValidMemberCount(Long teamId);

     /**
      * 创建团成员
      * @param team
      * @param order
      * @param isLeader
      * @return
      */
     GroupBuyTeamMember createMember(GroupBuyTeam team, Order order,Boolean isLeader);


     /**
      * 获得团成员
      * @param team
      * @param userId
      * @return
      */
     GroupBuyTeamMember getMemberBy(Long team, Long userId);



     void memberPayExpireHandler(Order order);

     /**
      * 查询自已参与的团
      * @param params
      * @return
      */
     PageUtils queryMyJoinTeamOrderPage(Map<String, Object> params);

     /**
      * 查询团下的成员
      * @param params
      * @return
      */
     List<GroupBuyTeamMemberSlimVO> queryMembers(Map<String, Object> params);

     GroupBuyOrderVO getByMemberOrder(Long userId, Long memberId);

     GroupBuyOrderVO getByMemberOrder(Long orderId);

     List<TeamMemberUserInfoVO> getTeamMembers(Long teamId);



     GroupBuyTeamMember getByOrderIdAndUserId(Long orderId,Long userId);
}

